<?php
C_base::yn_file('base'.DS.'htmlbase.php');
class firm extends htmlbase{
	
	var $_vpath = 'firm/';//pc/phone文件夹下的路径
	var $_waiyu = array('不限','英语','日语','法语','韩语','德语','泰语','西班牙语','俄语','意大利语','葡萄牙语','斯瓦西里语','阿拉伯语','马来语','瑞典语','塞尔威亚语','波斯语','越南语','芬兰语','乌克兰语','捷克语','阿尔巴尼亚语','波兰语','缅甸语','僧伽罗语','豪萨语','印地语');
	var $xz = array('面议','1000元以下','1000-2000元','2000-3000元','3000-5000元','5000-8000元','8000-10000元','10000元以上');
	var $xl = array('不限','高中以下','高中','中专/技校','大专','本科','硕士','博士','MBA/EMBA');
	var $jy = array('不限','应届生','一年','两年','三年','三年-五年','五年-十年','十年以上');
	var $_yysp = array('不限','基础水平','独立运用','熟练运用');
	var $_cskill = array('不限','一般','熟练','精通');
	var $sex = array('保密','男','女');
	
	function __construct(){
		parent::__construct();
	}
	
	function sfdl_user(){//判断是否登录
		if(!@$this->Ses('firm_id')){
			$this->_alert_location($this->_url.'/?act=firm&met=denglus','请先登录');
		}
	}
	
	function qxpd(){//权限判断
		$cx = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));
		if ($cx){
			if ($cx['zt'] == '0'){
				$this->_cuowu('请联系客服,激活账号');
			}
			if ($cx['zt'] == '2'){
				$this->_cuowu('因账号存在违规操作此帐号已冻结,请联系客服');
			}
			if ($cx['zt'] == '3'){
				$this->_cuowu('兼职注册需要缴纳保证金,请缴纳保证金');
			}
		}else {
			$this->_cuowu('非法操作!');
		}
	}
	
	function wjmm(){
		$this->title='忘记密码';
		$this->kf = '0371-55263806';
	}
	
	function zcqy(){
		$this->title='企业注册';
		$this->ssq = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));
		$this->hy = C_base::M('admin.recruit')->industry_ss();//行业类别
		$this->ss = array('股份','私营','集体','国有','合资','外贸');
	}
	
	function denglus(){
		$this->title = '企业登录';
	}
	
	function qyzc(){//企业注册全职
		$this->_is_html = 1;
		extract($this->_post());
		//print_r($_FILES['yimg']);
		if (@$name && @$pass && @$npass && @$qy_name && @$sshy && @$qyxz && 
		@$sheng && @$shi && @$qu && @$phone && @$linkman && @$address && 
		@$email && @$yyzzh &&@$yimg /* && @$zzjg  */&& @$yzm && @$tytk){
			
			//由6-33个字母加数字的字符组成，首位必须是字母
			if(!preg_match('/^[a-zA-Z]+(?![a-zA-Z]+$)[0-9A-Za-z]{5,32}$/',$name)){
				die('用户名格式错误');
			}
			
			/* $mpd = C_base::dybase('util')->zfpd($name, '6','','1');
			if ($mpd == '-1'){
				die('用户名不能小于6个字符!');
			}
			$mpds = C_base::dybase('util')->zfpd($name, '24',''); 
			if ($mpds == '-1'){
				die('用户名不能大于24个字符!'); 
			} */
			if ($pass != $npass){
				die('两次输入的密码不一致!');
			}
			$mmpd = C_base::dybase('util')->zfpd($pass, '6','','1');
			if ($mmpd == '-1'){
				die('密码不能小于6个字符!');
			}
			$mmpds = C_base::dybase('util')->zfpd($pass, '20','');
			if ($mmpds == '-1'){
				die('密码不能大于20个字符!');
			}
			$mcpd = C_base::dybase('util')->zfpd($qy_name, '4','','1');
			if ($mcpd == '-1'){
				die('企业名称不能小于2个字符中文!');
			}
			$mcpds = C_base::dybase('util')->zfpd($qy_name, '64','');
			if ($mcpds == '-1'){
				die('企业名称不能大于32个中文!');
			}
			$lx = C_base::dybase('util')->zfpd($linkman, '1','','1');
			if ($lx == '-1'){
				die('请填写联系人!');
			}
			$lxs = C_base::dybase('util')->zfpd($linkman, '30','');
			if ($lxs == '-1'){
				die('请将联系人字数控制在30个字符以内!');
			}
			if ($yzm != @$this->Ses('yzm')){
				die('验证码错误');
			}
			$p = util::preg_phone($phone);
			if (!$p){
				die('手机号错误!');
			}
			$e = util::preg_email($email);
			if (!$e){
				die('邮箱错误!');
			}
			if(!$tytk){
				die('请同意条款!');
			}
			$cx = C_base::M('admin.recruit')->qy_s(array('name'=>$name));
			if ($cx){
				die('账号已存在!');
			}
			$sj = array('name'=>$name,'pass'=>md5($pass),'time'=>time(),'dltime'=>time());
			$xr = C_base::M('admin.recruit')->qy_c($sj);
			if ($xr){
				$dh = @$gdqh.@$gddh;
				$sjs = array('uid'=>$xr,'qy_name'=>$qy_name,'sshy'=>$sshy,'qyxz'=>$qyxz,'sheng'=>$sheng,
						'shi'=>$shi,'qu'=>$qu,'linkman'=>$linkman,'phone'=>$phone,'address'=>$address,
						'email'=>$email,'yyzzh'=>$yyzzh,'yimg'=>$yimg,/* 'zzjg'=>$zzjg, */'gddh'=>$dh);
				$xxr = C_base::M('admin.recruit')->qys_c($sjs);
				if ($xxr){
					$this->Ses('firm_id',$xr);//企业用户id
					$this->Ses('recruit_type','2');
					die('注册成功!');
				}else {
					die('注册失败!');
				}
			}
		}else {
			die('请完善信息!');
		}
	}
	
	function qyzcs(){//企业注册兼职
		$this->_is_html = 1;
		extract($this->_post());
		if (@$name && @$pass && @$npass && @$yzm && @$sc && @$zm && @$fm){
			
			//由6-33个字母加数字的字符组成，首位必须是字母
			if(!preg_match('/^[a-zA-Z]+(?![a-zA-Z]+$)[0-9A-Za-z]{5,32}$/',$name)){
				die('用户名格式错误');
			}
			
			/* $mpd = C_base::dybase('util')->zfpd($name, '6','','1');
			if ($mpd == '-1'){
				die('用户名不能小于6个字符!');
			}
			$mpds = C_base::dybase('util')->zfpd($name, '24','');
			if ($mpds == '-1'){
				die('用户名不能大于24个字符!');
			} */
			if ($pass != $npass){
				die('两次输入的密码不一致!');
			}
			$mmpd = C_base::dybase('util')->zfpd($pass, '6','','1');
			if ($mmpd == '-1'){
				die('密码不能小于6个字符!');
			}
			$mmpds = C_base::dybase('util')->zfpd($pass, '20','');
			if ($mmpds == '-1'){
				die('密码不能大于20个字符!');
			}
			if ($yzm != @$this->Ses('yzm')){
				die('验证码错误');
			}
			if(!$tytk){
				die('请同意条款!');
			}
			$cx = C_base::M('admin.recruit')->qy_s(array('name'=>$name));
			if ($cx){
				die('账号已存在!');
			}
			$sj = array('name'=>$name,'pass'=>md5($pass),'time'=>time(),'dltime'=>time(),'zt'=>'3','lx'=>'3');
			$xr = C_base::M('admin.recruit')->qy_c($sj);
			if ($xr){
				$sjs = array('uid'=>$xr,'qy_name'=>$name,'scsfz'=>$sc,'sfzzm'=>$zm,'sfzfm'=>$fm);
				$xxr = C_base::M('admin.recruit')->qys_c($sjs);
				if ($xxr){
					$this->Ses('firm_id',$xr);//企业用户id
					die('注册成功!');
				}else {
					die('注册失败!');
				}
			}
		}else {
			die('请完善信息!');
		}
	}
	
	function denglu(){
		$this->_is_html = 1;
		extract($this->_post());
		if (@$name && @$pass){
			$n = C_base::dybase('util')->zfpd($name, '1','','1');
			if ($n == '-1'){
				die('请输入用户名!');
			}
			$p = C_base::dybase('util')->zfpd($pass, '1','','1');
			if ($p == '-1'){
				die('请输入密码!');
			}
			if (@$zt){
				if ($zt == '1'){
					if (!@$yzm){
						die('请输入验证码!');
					}
					if (@$yzm != @$this->Ses('yzm')) {
						die('验证码错误!');
					}
				}
			}else {
				die('非法操作!');
			}
			$cx = C_base::M('admin.recruit')->qy_s(array('name'=>$name));
			if ($cx){
				$ps = md5($pass);
				if ($ps != $cx['pass']){
					die('用户名或密码错误!');
				}else {
					/* if ($cx['zt'] == '0'){
						die('请等待客服审核!');
					} */
					if ($cx['zt'] == '2'){
						die('用户已冻结,请联系客服!');
					}
					if(@$xuan && $xuan == '1'){
						$this->cookie('firm_user',$name);
						$this->cookie('pass',$pass);
						$this->Ses('firm_id',$cx['id']);//企业用户id
						$this->Ses('firm_qxid',$cx['zt']);//权限判断
						$this->Ses('firm_lx',$cx['lx']);
						$this->Ses('recruit_type','2');
						$this->Ses('recruit_uid','');
						$this->Ses('recruit_zjid','');
					}else {
						$this->Ses('firm_id',$cx['id']);//企业用户id
						$this->Ses('firm_qxid',$cx['zt']);//权限判断
						$this->Ses('firm_lx',$cx['lx']);
						$this->Ses('recruit_type','2');
						$this->Ses('recruit_uid','');
						$this->Ses('recruit_zjid','');
					}
					$base = C_base::M('admin.recruit')->qys_s(array('uid'=>$cx['id']));//企业账号信息
					$this->Ses('qy_name',$base['qy_name']);
					$xgt = C_base::M('admin.recruit')->qy_u(array('id'=>$this->Ses('firm_id')),array('dltime'=>time()));
					die('登录成功');
				}
			}else {
				die('用户名或密码错误!');
			}
		}else {
			die('请输入用户名、密码!');
		}
	}
	
	function tc(){//退出登录
		$this->_is_html = 1;
		$this->Ses('firm_id','');
		$this->Ses('recruit_type','');
		$this->Ses('qy_name','');
		$this->Ses('firm_qxid','');
		$this->Ses('firm_lx','');
		$this->cookie_del();
		$this->_alert_location($this->_url);
	}
	
	function index(){
		$this->title = '企业中心';
		$this->sfdl_user();
		$base = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));//企业账号信息
		$this->Ses('qy_name',$base['qy_name']);
		$this->xx = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));//企业基本信息
		$this->xx['logo'] = $base['logo'];
		$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$this->Ses('firm_id')));
		if (@$tj['kfb']){
			$this->xx['kfb'] = $tj['kfb'];
		}else {
			$this->xx['kfb'] = '0';
		}
		if (@$tj['yfb']){
			$this->xx['yfb'] = $tj['yfb'];
		}else {
			$this->xx['yfb'] = '0';
		}
		if (@$tj['wd']){
			$this->xx['wd'] = $tj['wd'];
		}else {
			$this->xx['wd'] = '0';
		}
		if (@$tj['jlzs']){
			$this->xx['jlzs'] = $tj['jlzs'];
		}else {
			$this->xx['jlzs'] = '0';
		}
		if (@$tj['xzjl']){
			$this->xx['xzjl'] = $tj['xzjl'];
		}else {
			$this->xx['xzjl'] = '0';
		}
		if (@$tj['kxzjl']){
			$this->xx['kxzjl'] = $tj['kxzjl'];
		}else {
			$this->xx['kxzjl'] = '0';
		}
		$jl = array();
		for ($i=0;$i<=9;$i++){
			$jl[] = C_base::M('admin.recruit')->resume_ss_p($i,array('type'=>'0'),'1','10');//获取最新的10条数据
		}
		$hb = array();
		foreach ($jl as $k=>$v){
			if($v){
				foreach ($v as $kk=>$vv){
					$hb[]=$vv;
				}
			}
		}
		util::paixu($hb,'utime','desc');
		$tj = count($hb);
		if ($tj >= '10'){
			$hb = array_slice($hb, 0,10);
		}
		$c = $hb;
		foreach ($c as $k=>$v){
			if ($v['zhiwei']) {
				$z = $v['zhiwei'];
			}else {
				$z = $v['zwlb'];
			}
			$x = array_flip($this->xl);
			foreach ($x as $a=>$b){
				if ($b == $v['xueli']){
					$hb[$k]['xueli'] = $this->xl[$b];
				}
			}
			$hb[$k]['zw'] = $this->zwzh($z);
		}
		$this->rc = $hb;
		$this->jl = C_base::M('admin.recruit');
	}
	
	function qy_base(){
		$this->title = '完善资料';
		$this->sfdl_user();
		$this->id =$this->Ses('firm_id');
		$user = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));
		$this->user = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
		$this->user['time'] = $user['time'];
		$this->user['dltime'] = $user['dltime'];
		$this->hy = C_base::M('admin.recruit')->industry_ss();//行业类别
		$this->ss = array('股份','私营','集体','国有','合资','外贸');
		$this->sh = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//所有省列表
		if(@$this->user['sheng']){
			$this->shi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->user['sheng']));
			if(@$this->user['shi']){
				$this->qu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->user['shi']));
			}
		}
	}
	
	function qybj(){
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$id && @$sshy && @$qyxz && @$sheng && @$shi && @$qu && @$phone &&
		 @$linkman && @$address && @$email){
			$lx = C_base::dybase('util')->zfpd($linkman, '1','','1');
			if ($lx == '-1'){
				die('请填写联系人!');
			}
			$lxs = C_base::dybase('util')->zfpd($linkman, '60','');
			if ($lxs == '-1'){
				die('请将联系人字数控制在30个字符以内!');
			}
			$p = util::preg_phone($phone);
			if (!$p){
				die('手机号错误!');
			}
			$e = util::preg_email($email);
			if (!$e){
				die('邮箱错误!');
			}
			$cx = C_base::M('admin.recruit')->qy_s(array('id'=>$id));
			if ($cx){
				if (@$cltime){
					$cl = strtotime($cltime);
					$dq = strtotime(date('Y-m-d',time()));
					if ($cl>$dq){
						die('成立时间错误!');
					}
				}else {
					$cl = '';
				}
				$sjs = array('sshy'=>$sshy,'qyxz'=>$qyxz,'sheng'=>$sheng,
						'shi'=>$shi,'qu'=>$qu,'linkman'=>$linkman,'phone'=>$phone,'address'=>$address,'url'=>@$url,'qyjj'=>@$qyjj,
						'email'=>$email,/* 'zzjg'=>@$zzjg, */'qygm'=>@$qygm,'cltime'=>$cl,'gddh'=>@$gddh,'zczj'=>@$zczj);
				$xg = C_base::M('admin.recruit')->qys_u(array('uid'=>$id),$sjs);
				if ($xg){
					die('修改成功!');
				}else {
					die('修改失败!');
				}
			}
		}else {
			die('请完善信息!');
		}
	}
	
	function zpgl(){//企业招聘管理
		$this->title = '职位管理';
		$this->sfdl_user();
		$this->type = @$this->_get('type');
		$this->zw = $this->zwlx($this->type);
		/* $this->zw = $zw = C_base::M('admin.recruit')->qy_gw_ss($id,array('qid'=>$id,'style!'=>'2'));//获取已发布的职位信息
		$tj = C_base::M('admin.recruit')->qy_gw_tj_ss(array('qid'=>$id));//岗位统计信息
		$count = count($tj);
		foreach ($zw as $k=>$v){
			for ($i=0;$i<=$count;$i++){
				if (@$tj[$i]['gid']){
					if ($tj[$i]['gid'] == $v['id']){
						$this->zw[$k]['count'] = $tj[$i]['count'];
						$this->zw[$k]['wd'] = $tj[$i]['wd'];
						$this->zw[$k]['hits'] = $tj[$i]['hits'];
					}
				}
			}
		} */
	}
	
	function zwlx($type='',$pasize=''){
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		if(@$type == 1){  //未发布的职位
			$w = array('issue'=>2);
			$px = 'asc';
		}elseif (@$type == 2){ //已停止的职位
			$w = array('issue'=>0);
			$px = 'desc';
		}elseif (@$type == 3){ //委托投递的职位
			$w = array('issue'=>3);
			$px = 'desc';
		}else{ //正在发布的
			$w = array('issue'=>1,'jstime]'=>time());
			$px = 'asc';
		}
		if(@$pasize){
			$rs =  C_base::M('admin.recruit')->qy_gw_ss($this->Ses('firm_id'),$w,$page,$pasize);
		}else{
			$rs =  C_base::M('admin.recruit')->qy_gw_ss($this->Ses('firm_id'),$w);
		}
		if(@$px){
			return util::paixu($rs,'jstime',$px);
		}else{
			return $rs;
		}
	}
	
	function qyfb(){
		$this->title = '发布新职位';
		$this->sfdl_user();
		$this->qxpd();
		$pd = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));
		$this->pd = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
		$this->hy =  C_base::M('admin.recruit')->job_ss(array('sid'=>0));//职位类别
		$this->ssq = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));
	}
	
	function qyfbs(){
		$this->_is_html = 1;
		$this->sfdl_user();
		$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$this->Ses('firm_id')));
		if (@$tj){
				if ($tj['kfb'] == '0') {
					die('请购买套餐!');
				}else {
					$this->gwtj($this->Ses('firm_id'),'kfb',2);
					$this->gwtj($this->Ses('firm_id'),'yfb',1);
				}
		}else {
			die('请购买套餐!');
		}
		extract($this->_post());
		if (@$ycy && @$name && @$zwlb && @$zhiwei && @$number && @$money && @$sheng && @$shi && @$linkman && @$phone){/* @$qu && @$address && */
			if ($ycy == '1'){
				if (@$xueli){
					$xl = C_base::dybase('util')->zfpd($xueli, '1','','1');
					if($xl == '-1'){
						die('请选择学历!');
					}
					$jy = C_base::dybase('util')->zfpd($gzjy,'4','','1');
					if ($jy == '-1'){
						die('请选择工作经验!');
					}
				}else {
					die('请填写学历!');
				}
				if(@$address){
					$dd = C_base::dybase('util')->zfpd($address, '4','','1');
					if ($dd == '-1'){
						die('工作地点不能小于2个字!');
					}
					$dd = C_base::dybase('util')->zfpd($address, '60','');
					if ($dd == '-1'){
						die('工作地点不能大于30个字!');
					}
				}
			}elseif ($ycy == '2'){
				if (@$jztime == ''){
					die('请选择兼职时间!');
				}
			}
			$n = C_base::dybase('util')->zfpd($name, '4','','1');
			if ($n == '-1'){
				die('岗位名称最少2个汉字!');
			}
			$ns = C_base::dybase('util')->zfpd($name, '30','');
			if ($ns == '-1'){
				die('岗位名称最多15个汉字!');
			}
			$zw = C_base::dybase('util')->zfpd($zwlb, '1','','1');
			if ($zw == '-1'){
				die('请选择职位类型!');
			}
			$nu = C_base::dybase('util')->zfpd($number, '1','','1');
			if ($nu == '-1'){
				die('请填写招聘人数!');
			}
			if (!preg_match('/^[1-9]\d*|0$/', $number)) {//只能为数字
				die('招聘人数只能为数字!');
			}
			$lxr = C_base::dybase('util')->zfpd($linkman, '2','','1');
			if ($lxr == '-1'){
				die('联系人最少为2个字符!');
			}
			$lxrs = C_base::dybase('util')->zfpd($linkman, '30','');
			if ($lxrs == '-1'){
				die('联系人最多为30个字符!');
			}
			$p = util::preg_phone($phone);
			if (!$p){
				die('手机号错误!');
			}
			if (@$email){
				$e = util::preg_email($email);
				if (!$e){
					die('邮箱格式错误!');
				}
			}
			if(@$jstime){
				if(strtotime(@$jstime) <= time()){
					exit('招聘结束时间不得小于当前时间');
				}
				$jstime = strtotime(@$jstime);
			}else{
				$jstime = strtotime("3 month");  //默认三个月
			}
			if ($ycy == '1'){
				$zt = '0';
			}elseif ($ycy == '2'){
				$zt = '1';
			}
			$arr = array('name'=>$name,'zwlb'=>$zwlb,'number'=>$number,'money'=>$money,'xueli'=>@$xueli,'sheng'=>$sheng,
					'shi'=>$shi,'qu'=>$qu,'address'=>$address,'linkman'=>$linkman,'phone'=>$phone,'kstime'=>@$kstime,'jstime'=>$jstime,
					'gzjy'=>@$gzjy,'other'=>@$other,'age'=>@$age,'height'=>@$height,'sex'=>@$sex,'email'=>@$email,'language'=>@$language,
					'langpro'=>@$langpro,'cskill'=>@$cskill,'stay'=>@$stay,'issue'=>$issue,'zt'=>$zt,'jztime'=>@$jztime);
			$qyxx = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
			$arr['sshy'] = $qyxx['sshy'];
			$arr['qyxz'] = $qyxx['qyxz'];
			$arr['qy_name'] = $qyxx['qy_name'];
			$arr['qid'] = $this->Ses('firm_id');
			$arr['time'] = time();
			$xr = C_base::M('admin.recruit')->qy_gw_c($this->Ses('firm_id'),$arr);
			if ($xr){
				die('发布成功!');
			}else {
				die('发布失败!');
			}
		}else {
			die('请完善信息!');
		}
	}
	
	function fbqxs(){
		extract($this->_get());
		$this->sfdl_user();
		if (@$id){
			$this->cz = C_base::M('admin.recruit')->qy_gw_s($this->Ses('firm_id'),array('id'=>$id));
		}else {
			$this->cz = '';
		}
	}
	
	function fbqx(){//发布/取消发布修改
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$id) {
			$cx = C_base::M('admin.recruit')->qy_gw_s($this->Ses('firm_id'),array('id'=>$id));
			if ($cx){
				if (@$type == '1'){
					if(@$jstime){
						if(strtotime(@$jstime) < time()){
							exit('结束时间不得小于当前时间');
						}
						$u = array('jstime'=>strtotime(@$jstime),'issue'=>@$issue);
					}else{
						if($cx['jstime'] < time()){
							exit('结束时间不得小于当前时间');
						}
						$u = array('issue'=>@$issue);
					}
					$wz = '修改';
				}elseif (@$type == '2'){
					$u = array('time'=>time());
					$wz = '置顶';
				}elseif (@$type == '3'){
					$jstime = time()+86400;
					$u = array('jstime'=>$jstime,'issue'=>'1');
					$wz = '发布';
				}elseif (@$type == '4'){
					$u = array('issue'=>'3');
					$wz = '委托';
					C_base::M('kefu.shenhe')->wtzp_c(array('qid'=>$this->Ses('firm_id'),'gwid'=>$id,'wztime'=>$wttime));
				}else {
					$u = array('issue'=>'0');
					$wz = '停止';
				}
				$xg = C_base::M('admin.recruit')->qy_gw_u($this->Ses('firm_id'),array('id'=>$id),$u);
				if ($xg){
					die($wz.'成功');
				}else {
					die($wz.'失败');
				}
			}else {
				die('error');
			}
		}
	}
	
	function fbsc(){
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$id) {
			$cx = C_base::M('admin.recruit')->qy_gw_s($this->Ses('firm_id'),array('id'=>$id));
			if ($cx){
				$xg = C_base::M('admin.recruit')->qy_gw_d($this->Ses('firm_id'),array('id'=>$id));
				if ($xg) {
					$this->_cuowu('删除成功');
				}else {
					$this->_cuowu('删除失败!');
				}
			}else {
				$this->_cuowu('删除失败!');
			}
		}
	}
	
	function gwsx(){//刷新岗位
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id){
			$w = array('id'=>$id);
			$u = array('utime'=>time());
			$xg = C_base::M('admin.recruit')->qy_gw_u($this->Ses('firm_id'),$w,$u);
			if($xg == '1'){
				exit('刷新成功');
			}else{
				exit('刷新失败!');
			}
		}else{
			exit('刷新失败!');
		}
	}
	
	function fbxg(){
		$this->title = '岗位编辑';
		$this->sfdl_user();
		extract($this->_get());
		if (@$id){
			$this->nr = C_base::M('admin.recruit')->qy_gw_s($this->Ses('firm_id'),array('id'=>$id));
			$this->hy = C_base::M('admin.recruit')->industry_ss();//行业类别
			$this->xz = array('1000元以下','1000-2000元','2000-3000元','3000-5000元','5000-8000元','8000-12000元','12000-20000元','20000-25000元','25000元以上','面议');
			$this->xl = array('高中以下','高中','中专/技校','大专','本科','硕士','博士','MBA/EMBA');
			$this->jy = array('应届生','一年','两年','三年','三年-五年','五年-十年','十年以上');
			$this->sh = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//所有省列表
			if(@$this->nr['sheng']){
				$this->shi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->nr['sheng']));
				if(@$this->nr['shi']){
					$this->qu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->nr['shi']));
				}
			}
		}else {
			$this->_cuowu('修改失败!');
		}
	}
	
	function fgxgs(){//岗位编辑
		$this->_is_html = 1;
		if(!@$this->Ses('firm_id')){
			die('请先登录!');
		}
		extract($this->_post());
		$cx = C_base::M('admin.recruit')->qy_gw_s($this->Ses('firm_id'),array('id'=>$id));
		if ($cx){
			if (@$name && @$zwlb && @$number && @$money && @$sheng && @$shi &&
			@$qu && @$linkman && @$zzdd && @$phone && @$kstime && @$jstime){
				if ($cx['zt'] == '0'){
					if (@$xueli){
						$xl = C_base::dybase('util')->zfpd($xueli, '1','','1');
						if($xl == '-1'){
							die('请选择学历!');
						}
					}else {
						die('请填写学历!');
					}
				}
				if($cx['zt'] == '1'){
					if (@$jztime == ''){
						die('请选择兼职时间!');
					}
				}
			}else {
				die('请完善信息!');
			}
			$n = C_base::dybase('util')->zfpd($name, '4','','1');
			if ($n == '-1'){
				die('岗位名称最少2个汉字!');
			}
			$ns = C_base::dybase('util')->zfpd($name, '30','');
			if ($ns == '-1'){
				die('岗位名称最多15个汉字!');
			}
			$zw = C_base::dybase('util')->zfpd($zwlb, '1','','1');
			if ($zw == '-1'){
				die('请选择职位类型!');
			}
			$nu = C_base::dybase('util')->zfpd($number, '1','','1');
			if ($nu == '-1'){
				die('请填写招聘人数!');
			}
			if (!preg_match('/^[1-9]\d*|0$/', $number)) {//只能为数字
				die('招聘人数只能为数字!');
			}
			$lxr = C_base::dybase('util')->zfpd($linkman, '2','','1');
			if ($lxr == '-1'){
				die('联系人最少为2个字符!');
			}
			$lxrs = C_base::dybase('util')->zfpd($linkman, '30','');
			if ($lxrs == '-1'){
				die('联系人最多为30个字符!');
			}
			$dd = C_base::dybase('util')->zfpd($zzdd, '4','','1');
			if ($dd == '-1'){
				die('工作地点不能小于2个字!');
			}
			$dd = C_base::dybase('util')->zfpd($zzdd, '60','');
			if ($dd == '-1'){
				die('工作地点不能大于30个字!');
			}
			$p = util::preg_phone($phone);
			if (!$p){
				die('手机号错误!');
			}
			if (@$email){
				$e = util::preg_email($email);
				if (!$e){
					die('邮箱格式错误!');
				}
			}
			$jy = C_base::dybase('util')->zfpd($gzjy,'4','','1');
			if ($jy == '-1'){
				die('请选择工作经验!');
			}
			$arr = array('name'=>$name,'zwlb'=>$zwlb,'number'=>$number,'money'=>$money,'xueli'=>$xueli,'sheng'=>$sheng,
					'shi'=>$shi,'qu'=>$qu,'address'=>$address,'linkman'=>$linkman,'phone'=>$phone,'kstime'=>$kstime,'jstime'=>$jstime,
					'gzjy'=>$gzjy,'other'=>@$other,'age'=>@$age,'height'=>@$height,'sex'=>@$sex,'email'=>@$email,'language'=>$language,
					'langpro'=>$langpro,'cskill'=>$cskill,'stay'=>$stay,'issue'=>$issue,'jztime'=>@$jztime);
			$arr['time'] = time();
			$xr = C_base::M('admin.recruit')->qy_gw_u($this->Ses('firm_id'),array('id'=>$id),$arr);
			if ($xr){
				die('修改成功!');
			}else {
				die('修改失败!');
			}
		}else {
			$this->_cuowu('修改失败!');
		}
	}
	
	function jlsous(){//简历搜索
		$yx = array();
		if(@$this->_get('lx')){   //搜索
			$gjz = @$this->_get('gjz');
			if($this->_get('lx') == 1){  //名称
				$w = array('name?'=>$gjz);
			}elseif($this->_get('lx') == 2){  //年龄
				$w = array('age'=>$gjz);
			}elseif($this->_get('lx') == 3){  //学历
				if ($gjz){
					$w = array('xueli'=>$gjz);
				}else {
					$w = array();
				}
			}else{
				$w = array();
			}
			return $w;
		}
	}
	
	function jianli(){
		$this->title = '收到的简历';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$jl = C_base::M('admin.recruit')->qtoudi_ss($this->Ses('firm_id'),array('qid'=>$this->Ses('firm_id')),$page,$pagesize);
		$jls = $jl;
		if (@$jl['count'] != '0'){
			$w = $this->jlsous();
			foreach ($jl['data'] as $k=>$v){
				if (@$w){
					$ww = array_merge($w,array('id'=>$v['jid']));
				}else {
					$ww = array('id'=>$v['jid']);
				}
				$c = C_base::M('admin.recruit')->resume_s($v['uid'],$ww);
				if ($c){
					$gw = C_base::M('admin.recruit')->qy_gw_s($v['qid'],array('id'=>$v['zid'],'qid'=>$v['qid']));
					$jls['data'][$k]['name'] = $c['name'];
					$jls['data'][$k]['age'] = util::time_age($c['cstime']);
					$jls['data'][$k]['xueli'] = $this->xl[$c['xueli']];
					if (@$gw){
						$jls['data'][$k]['gwname'] = $gw['name'];
					}else {
						$jls['data'][$k]['gwname'] = '';
					}
					if (@$gw){
						if (@$gw['zhiwei']){
							$ts = C_base::M('admin.recruit')->job_s(array('id'=>$gw['zhiwei']));
							$jls['data'][$k]['zhiwei'] = @$ts['name'] ? @$ts['name'] :'';
						}else {
							$ts = C_base::M('admin.recruit')->job_s(array('id'=>$gw['zwlb']));
							$jls['data'][$k]['zhiwei'] = @$ts['name'] ? @$ts['name'] : '';
						}
					}
				}else {
					unset($jls['data'][$k]);
				}
			}
			$this->jl = $jls;
		}
	}
	
	function xzjl(){
		$this->title = '下载的简历';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$jl =  C_base::M('admin.recruit')->jlxz_ss($this->Ses('firm_id'),array('lx'=>'0','qid'=>$this->Ses('firm_id')),$page,$pagesize);
		$jls = $jl;
		if (@$jl['count'] != '0'){
			$w = $this->jlsous();
			foreach ($jl['data'] as $k=>$v){
				if (@$w){
					$ww = array_merge($w,array('id'=>$v['jlid']));
				}else {
					$ww = array('id'=>$v['jlid']);
				}
				$c = C_base::M('admin.recruit')->resume_s($v['uid'],$ww);
				if ($c){
					$jls['data'][$k]['name'] = $c['name'];
					$jls['data'][$k]['age'] = util::time_age($c['cstime']);
					$jls['data'][$k]['xueli'] = $this->xl[$c['xueli']];
					if ($c['gzjy']){
						$jls['data'][$k]['jy'] = $this->jy[$c['gzjy']];
					}else {
						$jls['data'][$k]['jy'] = '无';
					}
					if (@$c['zhiwei']){
						$ts = C_base::M('admin.recruit')->job_s(array('id'=>$c['zhiwei']));
						$jls['data'][$k]['zhiwei'] = @$ts['name'] ? @$ts['name'] :'';
					}else {
						$ts = C_base::M('admin.recruit')->job_s(array('id'=>$c['zwlb']));
						$jls['data'][$k]['zhiwei'] = @$ts['name'] ? @$ts['name'] : '';
					}
				}else {
					unset($jls['data'][$k]);
				}
			}
			$this->jl = $jls;
		}
	}
	
	function ztxg(){//修改简历未读状态
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$jid && @$uid && @$zid){
			$a = C_base::con('html.ruser')->toudi_zt(array('jid'=>$jid,'uid'=>$uid,'zid'=>$zid,'qid'=>$this->Ses('firm_id')));//修改状态
		}
	}
	
	function tdsc(){//删除投递的简历
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$jlid){
			$cx = C_base::M('admin.recruit')->qtoudi_s($this->Ses('firm_id'),array('id'=>$jlid));
			if ($cx){
				$sc = C_base::M('admin.recruit')->qtoudi_d($this->Ses('firm_id'),array('id'=>$jlid));
				if ($sc){
					die('cg');
				}else {
					die('删除失败!');
				}
			}else {
				die('删除失败!');
			}
		}else {
			die('非法操作');
		}
	}
	
	function xzsc(){//下载简历删除
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$qid && @$id){
			$aa = C_base::M('admin.recruit')->jlxz_s($qid,array('id'=>$id,'qid'=>$qid,'lx'=>'0'));
			if ($aa) {
				$bb = C_base::M('admin.recruit')->jlxz_d($qid,array('id'=>$id,'qid'=>$qid));
				if($bb){
					exit('cg');
				}else{
					exit('error');
				}
			}else {
				die('非法操作!');
			}
		}
	}
	
	function cha(){
		$this->title = '简历查看';
		$this->sfdl_user();
		extract($this->_get());
		if (@$id){
			$jl = C_base::M('admin.recruit')->qtoudi_ss($this->Ses('firm_id'),array('zid'=>$id));//获取简历信息
			$this->zy = C_base::M('admin.recruit')->major_ss();
			$this->xueli = array('高中以下','高中','中专/技校','大专','本科','硕士','博士','MBA/EMBA');
			$this->jl = array();
			if ($jl){
				foreach ($jl as $k=>$v){
					$this->jl[$k] = C_base::M('admin.recruit')->resume_s($v['uid'],array('id'=>$v['jid']));
					$this->jl[$k]['age'] = util::time_age($this->jl[$k]['cstime']);
					$this->jl[$k]['lx'] = $v['zt'];
				}
			}
		}else {
			$this->_cuowu('非法操作!');
		}
	}
	
	function jlsc(){//简历删除
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_get());
		if (@$id){
			$cx = C_base::M('admin.recruit')->qtoudi_s($this->Ses('firm_id'),array('id'=>$id));
			if ($cx){
				$sc = C_base::M('admin.recruit')->qtoudi_d($this->Ses('firm_id'),array('id'=>$id));
				if ($sc) {
					$this->_cuowu('删除成功!');
				}else {
					$this->_cuowu('删除失败!');
				}
			}else {
				$this->_cuowu('删除失败!');
			}
		}else {
			$this->_cuowu('删除失败!');
		}
	}
	
	function logo(){//上传企业logo
		$this->title = '企业logo';
		$this->sfdl_user();
		$logo = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
		$this->logo = $logo['logo'];
	}
	
	function logos(){
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$id){
			$cx = C_base::M('admin.recruit')->qys_u(array('uid'=>$this->Ses('firm_id')),array('logo'=>$id));
			if ($cx){
				die('cg');
			}else {
				die('修改失败!');
			}
		}else {
			die('非法操作!');
		}
	}
	
	function qyss(){//找人才全职
		$this->title = '找人才';
		if(@!$this->Ses('recruit_zjid') && @!$this->Ses('firm_id') ){
			$this->_alert_location($this->_url,'请先登录');
		}
		if(@$this->Ses('firm_id')){
			$this->qxpd();
		}
		$this->zwlb = C_base::M('admin.recruit')->job_ss(array('sid'=>0));//职位类别
		if($this->zwlb){
			foreach ($this->zwlb as $k=>$v){
				$this->zwlb[$k]['xiao'] = C_base::M('admin.recruit')->job_ss(array('sid'=>$v['id']));
			}
		}
		$this->hy = C_base::M('admin.recruit')->industry_ss();//行业类别
		$this->zy = C_base::M('admin.recruit')->major_ss();//专业类别
		$this->dz = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//省
		if(@$this->dz){
			foreach ($this->dz as $k=>$v){
				$this->dz[$k]['xiaji'] = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$v['area_id']));//市	
			}
		}
		$this->mh = @$this->_get('mh') ? $this->_get('mh') : 'qyname';
		$this->sid = $sid = @$this->_get('shi') ? $this->_get('shi') : '410100';//郑州市
		$this->sname = @C_base::con('html.ruser')->user_dz($sid);
		$this->dzs = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$sid));
		
	}
	
	function qyssz(){//找人才兼职
		$this->qyss();
	}
	
	function qysss(){//找人才搜索结果
		$this->qyss();
		if(!@$this->_get()){
			$this->_cuowu('请选择搜索项');
		}
		extract($this->_get());
		if(!@$lx){//非法操作
			$this->_cuowu('非法操作');
		}
		$w = array();
		if(@$zwlb){//职位类别
			$w['zwlb'] = $zwlb;
		}
		if(@$zhiwei){//职位类别
			$w['zhiwei'] = $zhiwei;
		}
		if(@$lx == 'qz' && @$zylb){//专业类别
			$w['zhuanye'] = $zylb;
		}
		if(@$lx == 'qz' && @$gjz){//关键字
			$w['title?'] = $gjz;
		}
		if(@$shi){//市
			$w['qzshi'] = $shi;
		}
		if(@$qu){//区
			$w['qzqu'] = $qu;
		}
		if(@$lx == 'qz' && @$jy){//工作经验
			$w['gzjy'] = $jy;
		}
		if(@$xueli){//学历
			$w['xueli'] = $xueli;
		}
		if(@$sex){//性别
			$w['sex'] = $sex;
		}
		if(@$xz){//薪资
			preg_match_all('/\d+/',$xz,$money);//取出数字
			if(@$money[0]){
				if(@$money[0][0]){
					if(strpos($xz, '以下') !== false){//1000元以下
						$w['money|'] = $money[0][0];
					}else{
						$w['money]'] = $money[0][0];
					}
				}
				if(@$money[0][1]){
					$w['money|'] = $money[0][1];
				}
			}
		}
		if(@$lx == 'jz' && @$jzsj){//兼职时间
			if(@$jzsd){//上午/下午/晚上
				$jzsd = array_filter(explode(',', $jzsd));
			}else{//全天
				$jzsd = array('1','2','3');
			}
			$jzsj = array_filter(explode(',', $jzsj));
			$jztime = array();
			foreach ($jzsd as $kk=>$vv){
				foreach ($jzsj as $k=>$v){
					$jztime[] = $v.'_'.$vv;
				}
			}
			if($jztime){
				$shu = count($jztime);
				foreach ($jztime as $k=>$v){
					$c = 'w'.$k;
					$$c = array('jztime?'=>','.$v.',');
				}
			}
		}
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		if ($w || @$jztime){
			$w['zt'] = (@$lx == 'jz') ? 1 : 0;//全职/兼职
			$w['type'] = 0;//开放
			$w['sszt'] = 0;//可以被搜索到的简历(0-可以被搜索的简历,1-用户升级为专家，简历状态改为1，不能被搜索)
			$r = array();
			for($i=0;$i<=9;$i++){
				if(@$jztime){//兼职时间搜索
					$shu = count($jztime) - 1;
					$wo = array();
					for($j=1;$j<=$shu;$j++){
						$n = 'w'.$j;
						$wo[]= array_merge($w,$$n);
					}
					$w = array_merge($w,$w0);
					$r[$i] = C_base::M('admin.recruit')->resume_sso($i,$w,$wo);
				}else{
					$r[$i] = C_base::M('admin.recruit')->resume_ss($i,$w);
				}
			}
			$rs = util::arr_one($r);
			$this->rs = array();
			if(@$rs){
				$this->rs['count'] = count($rs);
				$rs = util::paixu($rs,'utime','desc');//排序
				$rs = util::fenye($rs,$page,$pagesize);//分页
				foreach ($rs as $k=>$v){
					$this->rs['data'][$k] = $v;
					$this->rs['data'][$k]['utime'] = util::time_date($v['utime']);
					$this->rs['data'][$k]['xshi'] = C_base::con('html.ruser')->user_dz($v['xshi']);
					$this->rs['data'][$k]['wzd'] = C_base::con('html.ruser')->resume_wzd($v['uid']);
				}
			}
		}else{
			$this->_cuowu('搜索内容不能为空');
		}
	}
	
	function gw_xx(){
		$this->title = '公司介绍';
		if(@!$this->Ses('recruit_zjid') && @!$this->Ses('firm_id') && @!$this->Ses('recruit_uid')){
			$this->_alert_location($this->_url,'请先登录');
		}
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		if ($this->Ses('recruit_type') == '2') {
			$this->sfdl_user();
			$xx = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
			$u = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));
			$xx['zjtime'] = @$u['dltime'] ? @$u['dltime'] : $u['time'];
			$xx['sheng'] = $this->hqssq($xx['sheng']);
			$xx['shi'] = $this->hqssq($xx['shi']);
			$xx['qu'] = $this->hqssq($xx['qu']);
			$xx['zwlb'] = $this->zwzh($xx['sshy']);
			$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$this->Ses('firm_id')));
			if (@$tj['yfb']){
				$xx['yfb'] = $tj['yfb'];
			}else {
				$xx['yfb'] = '0';
			}
			if ($xx['zid']) {
				$z = C_base::con('html.job')->zzxx($xx['zid']);
				$xx['zname'] = @$z['name'] ? @$z['name'] : '';
				$xx['ztx'] = @$z['touxiang'] ? @$z['touxiang'] : '';
			}
			$xx['zp'] = C_base::M('admin.recruit')->qy_gw_ss($this->Ses('firm_id'),array('qid'=>$this->Ses('firm_id')),$page,$pagesize);
			$this->xx = $xx;
		}else {
			extract($this->_get());
			if (@$qid){
				if(@$type){   //vip专家
					$this->type = $type;
					$yh= C_base::M('admin.recruit')->user_s(array('id'=>$qid));
					$xx = C_base::con('html.job')->zzxx($qid);
					$rr = C_base::con('html.job')->zwlx($qid);
					$this->xx = array('qy_name'=>$xx['name'],'logo'=>$xx['touxiang'],'qyxz'=>'民营/私营公司','yfb'=>count($rr),'zname'=>$xx['name'],
							'ztx'=>$xx['touxiang'],'zycj'=>$xx['zycj'],'scly'=>$xx['scly'],'gddh'=>@$yh['phone'],'email'=>@$yh['email'],'zid'=>$qid);
					$this->xx['zjtime'] = @$yh['dltime'] ? @$yh['dltime'] : $yh['time'];
					$this->xx['sheng'] = $this->hqssq($xx['xsheng']);
					$this->xx['shi'] = $this->hqssq($xx['xshi']);
					$this->xx['address'] = @$this->xx['sheng'].@$this->xx['shi'];
					$rs = C_base::con('html.job')->zwlx($qid,'',$pagesize);
					if(@$rs){
						foreach ($rs as $k=>$v){
							$rs[$k]['sname'] =$this->hqssq($v['sheng']);
							$rs[$k]['cname'] =$this->hqssq($v['shi']);
						}
					}
					$this->xx['zp']['data'] = @$rs;
				}else{
					$xx = C_base::M('admin.recruit')->qys_s(array('uid'=>$qid));
					$u = C_base::M('admin.recruit')->qy_s(array('id'=>$qid));
					$xx['zjtime'] = @$u['dltime'] ? @$u['dltime'] : @$u['time'];
					$xx['sheng'] = $this->hqssq($xx['sheng']);
					$xx['shi'] = $this->hqssq($xx['shi']);
					$xx['qu'] = $this->hqssq($xx['qu']);
					$xx['zwlb'] = $this->zwzh($xx['sshy']);
					$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$qid));
					if (@$tj['yfb']){
						$xx['yfb'] = $tj['yfb'];
					}else {
						$xx['yfb'] = '0';
					}
					if ($xx['zid']) {
						$z = C_base::con('html.job')->zzxx($xx['zid']);
						$xx['zname'] = @$z['name'] ? @$z['name'] : '';
						$xx['ztx'] = @$z['touxiang'] ? @$z['touxiang'] : '';
					}
					$xx['zp'] = C_base::M('admin.recruit')->qy_gw_ss($qid,array('qid'=>$qid),$page,$pagesize);
					$this->xx = $xx;
				}

			}else {
				$this->_cuowu('error');
			}
		}
	}
	
	function gw_xxs(){//岗位详情
		$this->title = '职位预览';
		if(@!$this->Ses('recruit_zjid') && @!$this->Ses('firm_id') && @!$this->Ses('recruit_uid')){
			$this->_alert_location($this->_url,'请先登录');
		}
		extract($this->_get());
		if (@$id && @$qid){
			$xx = C_base::M('admin.recruit')->qy_gw_s($qid,array('id'=>$id,'qid'=>$qid));
			$xx['sheng'] = $this->hqssq($xx['sheng']);
			$xx['shi'] = $this->hqssq($xx['shi']);
			$xx['qu'] = $this->hqssq($xx['qu']);
			$xx['zwlb'] = $this->zwzh($xx['zwlb']);
			if($xx['style'] == 2){
				$cc = C_base::con('html.job')->zzxx($qid);
				$sd = $this->hqssq(@$cc['xsheng']);
				$sc = $this->hqssq(@$cc['xshi']);
				$rr = C_base::con('html.job')->zwlx($qid);
				$yh= C_base::M('admin.recruit')->user_s(array('id'=>$qid));
				$xx['yfb'] = count($rr);
				$xx['gsxx'] = array('qy_name'=>$cc['name'],'logo'=>$cc['touxiang'],'qyxz'=>'民营/私营公司','gddh'=>@$yh['phone'],'email'=>@$yh['email'],'zid'=>@$qid);		
				$xx['gsxx']['address'] = @$sd.@$sc;
				$xx['zjtime'] = @$yh['dltime'] ? @$yh['dltime'] : $yh['time'];
				$xx['zname'] = @$cc['name'] ? @$cc['name'] : '';
				$xx['ztx'] = @$cc['touxiang'] ? @$cc['touxiang'] : '';
			}else{
				$xx['gsxx'] = C_base::M('admin.recruit')->qys_s(array('uid'=>$qid));//获取企业信息
				$u = C_base::M('admin.recruit')->qy_s(array('id'=>$qid));
				$xx['zjtime'] = @$u['dltime'] ? @$u['dltime'] : $u['time'];
				$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$qid));
				if (@$tj['yfb']){
					$xx['yfb'] = $tj['yfb'];
				}else {
					$xx['yfb'] = '0';
				}
				if ($xx['gsxx']['zid']) {
					$z = C_base::con('html.job')->zzxx($xx['gsxx']['zid']);
					$xx['zname'] = @$z['name'] ? @$z['name'] : '';
					$xx['ztx'] = @$z['touxiang'] ? @$z['touxiang'] : '';
				}
			}
			if(@$this->Ses('recruit_uid')){  //浏览数+1
				C_base::M('admin.recruit')->qy_gw_u($qid,array('id'=>$id),array('hits+'=>1));
			}
			$this->xx = $xx;
		}else {
			$this->_cuowu('error!');
		}
	}
	
	function hqssq($id){//省市区转换
		$zh = C_base::M('admin.port')->linkage_s(array('area_id'=>$id));
		return @$zh['area_name'];
	}
	
	function zwzh($id){//职位转换
		$zw = C_base::M('admin.recruit')->job_s(array('id'=>$id));
		return $zw['name'];
	}
	
	function mmxg(){//密码修改
		$this->title = '密码修改';
		$this->sfdl_user();
	}
	
	function mmxgs(){
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		if (@$pass && @$npass && @$nnpass){
			$cx = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));
			$m = md5($pass);
			if ($m == $cx['pass']){
				if ($npass != $nnpass){
					die('两次密码不一致,请重新输入!');
				}
				$x = md5($npass);
				if ($x == $cx['pass']){
					die('新密码不能和原始密码一样!');	
				}
				$mmpd = C_base::dybase('util')->zfpd($npass, '6','','1');
				if ($mmpd == '-1'){
					die('密码不能小于6个字符!');
				}
				$mmpds = C_base::dybase('util')->zfpd($npass, '20','');
				if ($mmpds == '-1'){
					die('密码不能大于20个字符!');
				}
				$xg = C_base::M('admin.recruit')->qy_u(array('id'=>$this->Ses('firm_id')),array('pass'=>md5($npass)));
				if ($xg){
					die('修改成功!');
				}else {
					die('修改失败!');
				}
			}else {
				die('原始密码错误,请重新输入!');
			}
		}else {
			die('修改失败!');
		}
	}
	
	function zdzj(){//指定专家
		$this->title = '指定企业专家';
		$this->sfdl_user();
		extract($this->_post());
		$xx = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
		if (@$xx['zid']) {
			$this->zjxx = C_base::M('admin.recruit')->ubase_s(array('uid'=>$xx['zid']));
			$this->zjxx['cst'] = util::time_age($this->zjxx['cstime']);
			$t = C_base::M('admin.recruit')->user_s(array('id'=>$xx['zid']));
			$this->zjxx['time'] = @$t['time'] ?@$t['time'] : '';
			$this->zjxx['zt'] = '1';
		}/* else {
			if (@$tj) {
				$this->zjxx = C_base::M('admin.recruit')->ubase_s(array('uid'=>$tj));
				print_r($this->zjxx);
			}
		} */
	}
	
	function zdzjart(){//指定专家
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		$qyid = $this->Ses('firm_id');
		$xx = C_base::M('admin.recruit')->qys_s(array('uid'=>$qyid));
		if(@$xx['zid']){
			exit('您当前已经有指定专家，不可再指定');
		}
		if(@!$tj){
			exit('搜索账号不能为空');
		}
		$cha = C_base::M('admin.recruit')->user_s(array('phone'=>$tj));
		if(!@$cha){
			$cha = C_base::M('admin.recruit')->user_s(array('email'=>$tj));
		}
		if(@!$cha){
			exit('此用户不存在，请填写有效账户');
		}else{
			if($cha['lx'] == 1 || $cha['lx'] == 2){
				exit('此用户已有关联企业或为VIP专家不能被关联');
			}else{
				if($cha['dongjie'] == 1){
					exit('该用户被冻结,不能被指定');
				}else{
					$zjxx = C_base::M('admin.recruit')->ubase_s(array('uid'=>$cha['id']));
					if (@$zjxx['cstime']){
						$zjxx['cst'] = util::time_age($zjxx['cstime']);
					}else {
						$zjxx['cst'] = '';
					}
					$t = C_base::M('admin.recruit')->user_s(array('id'=>$cha['id']));
					$zjxx['time'] = @$t['time'] ?@$t['time'] : '';
					$str = '<div class="f_l l_m20">';
					if(@$zjxx['touxiang']){
						$str .='<img width="173px" height="173px" src="'.$this->_url.'/material/photo.php?id='.$zjxx['touxiang'].'">';
					}else{
						$str .='<img width="173px" height="173px" src="'.$this->style.'/images/geren_173.png">';
					}
					$str .='</div>
							<div class="f_l l_m35 c_656565">
								<div class="t_m10">
									<span class="f_b">姓名：</span><span>'.@$zjxx['name'].'</span>
								</div>
								<div class="t_m5">
									<span class="f_b">年龄：</span><span>'.@$zjxx['cst'].'</span>
								</div>
								<div class="t_m5">
									<span class="f_b">学历：</span><span>'.@$this->xl[$zjxx['xueli']].'</span>
								</div>
								<div class="t_m5">
									<span class="f_b">毕业院校：</span><span>'.@$zjxx['byyx'].'</span>
								</div>
								<div class="t_m5">
									<span class="f_b">注册时间：</span><span>'.@date('Y-m-d',$zjxx['time']).'</span>
								</div>
								<div class="t_m12">';
						$str .= '<div class="f_l w_100 h_35 t_c l_h35 bc_E16400 c_FFF point" onclick="zd()">
										指定专家
									</div>';
					$str .= '</div></div>';
					$str .= '<input type="hidden" id="zd" value='.$tj.' >';
					exit($str);
				}
			}
		}
	}
	
	function zdzjs(){
		$this->_is_html = 1;
		$this->sfdl_user();
		extract($this->_post());
		$qyid = $this->Ses('firm_id');
		$xx = C_base::M('admin.recruit')->qys_s(array('uid'=>$qyid));
		if(@$xx['zid']){
			exit('您当前已经有指定专家，不可再指定');
		}
		if(@!$tj){
			exit('搜索账号不能为空');
		}
		$cha = C_base::M('admin.recruit')->user_s(array('phone'=>$tj));
		if(!@$cha){
			$cha = C_base::M('admin.recruit')->user_s(array('email'=>$tj));
		}
		if(@!$cha){
			exit('此用户不存在，请填写有效账户');
		}else{
			if($cha['lx'] == 1 || $cha['lx'] == 2){
				exit('此用户已有关联企业或为VIP专家不能被关联');
			}else{
				if($cha['dongjie'] == 1){
					exit('该用户被冻结,不能被指定');
				}else{
					$a = C_base::M('admin.recruit')->user_u(array('id'=>$cha['id']),array('lx'=>1,'qyid'=>$this->Ses('firm_id')));
					$b = C_base::M('admin.recruit')->qys_u(array('uid'=>$qyid),array('zid'=>$cha['id']));
					
					//将用户的简历都标记为不可搜索
					$r = array();
					$w = array('uid'=>$cha['id'],'sszt'=>0);
					for($i=0;$i<=9;$i++){
						$r[$i] = C_base::M('admin.recruit')->resume_sso($i,$w);
					}
					$rs = util::arr_one($r);
					foreach($rs as $k => $v){
						$w = array('uid'=>$v['uid'],'sszt'=>0);
						$u = array('sszt'=>1);
						C_base::M('admin.recruit')->resume_u($v['uid'],$w,$u);
					}
					
					if($a && $b){
						exit('指定成功');
					}else{
						exit('error');
					}
				}
			}
		}
	}
	
	function qxzj(){//取消企业指定专家
		$this->_is_html = 1;
		$this->sfdl_user();
		$cx = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));
		if (@$cx['zid']) {
			$xg = C_base::M('admin.recruit')->qys_u(array('uid'=>$this->Ses('firm_id')),array('zid'=>''));
			$a = C_base::M('admin.recruit')->user_u(array('id'=>$cx['zid']),array('lx'=>'0','qyid'=>'0'));
			
			//将专家的简历都标记为可搜索
			$r = array();
			$w = array('uid'=>$cx['zid'],'sszt'=>1);
			for($i=0;$i<=9;$i++){
				$r[$i] = C_base::M('admin.recruit')->resume_sso($i,$w);
			}
			$rs = util::arr_one($r);
			foreach($rs as $k => $v){
				$w = array('id'=>$v['id'],'uid'=>$v['uid'],'sszt'=>1);
				$u = array('sszt'=>0);
				C_base::M('admin.recruit')->resume_u($v['uid'],$w,$u);
			}
			
			$this->_alert_location($this->_url.'/?act=firm&met=zdzj');
		}else {
			$this->_cuowu('没有指定的专家');
		}
	}
	
	
	/**
	 * 企业统计信息修改
	 * @param 企业id $qid
	 * @param 修改类型 $lx
	 * @param + - $t
	 */
	function gwtj($qid,$lx,$t){
		if ($qid && $lx && $t){
			$a = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$qid));
			if ($t == '1'){
				$t = '+';
			}elseif ($t == '2'){
				$t = '-';
			}
			$z = $lx.$t;
			if ($a){
				$x = C_base::M('admin.recruit')->qy_gw_tj_u(array('qid'=>$qid),array($z=>'1'));
			}
		}
	}
	
	
	function bs(){//企业标识
		$this->title = '企业标识';
		$this->sfdl_user();
		$base = C_base::M('admin.recruit')->qys_s(array('uid'=>$this->Ses('firm_id')));//企业账号信息
		$this->xx = C_base::M('admin.recruit')->qy_s(array('id'=>$this->Ses('firm_id')));//企业基本信息
		$this->xx['logo'] = $base['logo'];
	}
	
	function bzjzf(){
		$this->title = '缴纳保障金';
		$this->sfdl_user();
		$this->mc = C_base::M('admin.recruit')->qy_s(array('id'=>@$this->Ses('firm_id')));
		$this->je = $je = '100.00';
		$this->lx = $this->_get('lx');
	}
	
	/**
	 * 企业标识
	 * 支付宝支付
	 */
	function zfbcz(){  //支付宝充值
		require_once ('../sys/base/zfb/alipay.config.php');
		require_once ('../sys/base/zfb/lib/alipay_submit.class.php');
		$lx = $this->_post('lx');
		if(@!$lx){
			exit('系统异常');
		}else{
			if($lx == '1'){  //申请企业标识
				$money = '100.00';
				$co = '申请企业标识';
				$out_trade_no = 'qybs-'.$this->Ses('firm_id').'-'.time();
			}elseif ($lx == '2'){ //缴纳保证金
				$money = '100.00';
				$co = '缴纳保证金';
				$out_trade_no = 'bzjzfs-'.$this->Ses('firm_id').'-'.time();
			}else{
				exit('系统异常');
			}
			if(@!$this->Ses('firm_id')){
				exit('系统异常');
			}
			$parameter = array(
					"service" => "create_direct_pay_by_user",
					"partner" => trim($alipay_config['partner']),
					"seller_email" => trim($alipay_config['seller_email']),
					"payment_type"	=> 1, //支付类型 不能修改
					"notify_url"	=> 'http://www.sky9001.com/notify_url.php', //服务器异步通知页面路径
					"return_url"	=> 'http://www.sky9001.com/?act=firm', //页面跳转同步通知页面路径
					"out_trade_no"	=> $out_trade_no, //商户订单号
					"subject"	=> $co, //订单名称
					"total_fee"	=> $money, //付款金额
					"body"	=> $money.'元', //订单描述
					"_input_charset" => trim(strtolower($alipay_config['input_charset'])) //字符编码格式 目前支持 gbk 或 utf-8
			);
			$alipaySubmit = new AlipaySubmit($alipay_config);
			$html_text = $alipaySubmit->buildRequestForm($parameter,"get", "下一步",1);
			print_r($html_text);exit;
		}
	}
	
	/**
	 * 微信支付
	 */
	function sys(){  //微信充值【购买套餐】
		$lx = $this->_get('lx');
		if(@!$lx){
			exit('系统异常');
		}else{
			if($lx == '1'){  //申请企业标识
				$money = '100.00'*100;
				$co = '申请企业标识';
				$out_trade_no = 'qybs-'.$this->Ses('firm_id').'-'.time();
			}elseif ($lx == '2'){ //缴纳保证金
				$money = '100.00'*100;
				$co = '缴纳保证金';
				$out_trade_no = 'bzjzfs-'.$this->Ses('firm_id').'-'.time();
			}else{
				exit('系统异常');
			}
			if(@!$this->Ses('firm_id')){
				exit('系统异常');
			}else{
				$uid= $this->Ses('firm_id');
				C_base::yn_file('base'.DS.'ceshi'.DS.'WxPayPubHelper'.DS.'WxPayPubHelper.php');
				//使用统一支付接口
				$unifiedOrder = new UnifiedOrder_pub();
				//设置统一支付接口参数
				//设置必填参数
				$unifiedOrder->setParameter("body",$co);//商品描述
				//自定义订单号，此处仅作举例
				$unifiedOrder->setParameter("out_trade_no","$out_trade_no");//商户订单号
				$unifiedOrder->setParameter("total_fee",$money);//总金额
				$unifiedOrder->setParameter("notify_url",WxPayConf_pub::NOTIFY_URL);//通知地址
				$unifiedOrder->setParameter("trade_type","NATIVE");//交易类型
				//获取统一支付接口结果
	
				$unifiedOrderResult =$this->unifiedOrderResult= $unifiedOrder->getResult();
				//商户根据实际情况设置相应的处理流程
				if ($unifiedOrderResult["return_code"] == "FAIL")
				{
					//商户自行增加处理流程
					echo "通信出错：".$unifiedOrderResult['return_msg']."<br>";
				}
				elseif($unifiedOrderResult["result_code"] == "FAIL")
				{
					//商户自行增加处理流程
					echo "错误代码：".$unifiedOrderResult['err_code']."<br>";
					echo "错误代码描述：".$unifiedOrderResult['err_code_des']."<br>";
				}
				elseif($unifiedOrderResult["code_url"] != NULL)
				{
					//从统一支付接口获取到code_url
					$this->code_url = $unifiedOrderResult["code_url"];
					//商户自行增加处理流程
					//......
				}
			}
		}
	}
	function bzjzfs($firm){//保障金支付
		$this->_is_html = 1;
		$je = '100';
		$xg = C_base::M('admin.recruit')->qy_u(array('id'=>$firm),array('zt'=>'1'));
		$xgs = C_base::M('admin.recruit')->qyzcjl_c(array('qid'=>$firm,'lx'=>'1','je'=>$je,'time'=>time()));
	}
	
	function qybz($firm){//企业普通用户升级为会员
		$this->_is_html = 1;
		$je = '100';
		$xg = C_base::M('admin.recruit')->qy_u(array('id'=>$firm),array('lx'=>'2'));
		$xgs = C_base::M('admin.recruit')->qyzcjl_c(array('qid'=>$firm,'lx'=>'4','je'=>$je,'time'=>time()));
	}
	
	function tj(){//简历数统计
		$this->title = '简历数统计';
		$this->sfdl_user();
	}
	
	function hqxx(){//c连c
		$this->_is_html = 1;
		$xx = C_base::M('admin.recruit')->qy_ss(array('zt'=>'1'));
		$x = $xx;
		foreach ($x as $k=>$v){
			$x[$k]['base'] = C_base::M('admin.recruit')->qys_s(array('uid'=>$v['id']));
		}
		return $x;
	}
	
}